﻿using ServiceStack.IO;

namespace ServiceStack.Redis
{
    /// <summary>
    /// Redis的终结点 类实例
    /// </summary>
    public class RedisEndpoint : IEndpoint
    {
        /// <summary>
        /// 提供host和ip的构造函数
        /// </summary>
        /// <param name="host"></param>
        /// <param name="port"></param>
        public RedisEndpoint(string host, int port)
        {
            this.Host = host;
            this.Port = port;
        }
        /// <summary>
        /// 提供host、port以及密码的构造函数
        /// </summary>
        /// <param name="host"></param>
        /// <param name="port"></param>
        /// <param name="password"></param>
        public RedisEndpoint(string host, int port, string password)
            : this(host, port)
        {
            this.Password = password;
        }
        /// <summary>
        /// 服务实例ip地址
        /// </summary>
        public string Host { get; private set; }

        /// <summary>
        /// redis实例的端口
        /// </summary>
        public int Port { get; private set; }
        /// <summary>
        /// redis的密码
        /// </summary>
        public string Password { get; set; }
        /// <summary>
        /// 是否要求认证  提供密码
        /// </summary>
        public bool RequiresAuth { get { return !string.IsNullOrEmpty(Password); } }
    }
}